package edu.cuit.svsp.service.impl;

import edu.cuit.svsp.mapper.FollowMapper;
import edu.cuit.svsp.service.FollowService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @className: FollowServiceImpl
 * @author: pjy
 * @description: 关注服务实现类
 * @date: 2024/7/6
 */
@Service
public class FollowServiceImpl implements FollowService {
    @Resource
    private FollowMapper followMapper;
    @Transactional
    @Override
    public boolean updateFollow(boolean isFollow,Integer fid, Integer uid) {
        if(isFollow){
            followMapper.addFollow(uid,fid);
        }else {
            followMapper.dellFollow(uid,fid);
        }
        return true;
    }

    @Override
    public boolean findFollow(Integer fid, Integer uid) {
        return followMapper.findFollow(fid,uid);
    }
}
